# wvdial
# Builds from https://github.com/puppylinux-woof-CE/petbuilds

. ../func
. ../build.conf

URL=http://distro.ibiblio.org/puppylinux/sources/w
PKG=wvdial
VER=1.61
COMP=tar.gz
DESC="dialer for ppp"
DEPS=+ppp,+wvstreams
CAT=BuildingBlock
DESKTOP=wvdial.desktop
BUILD=
CWD=$(pwd)
[ -z "$MWD" ] && MWD=$(dirname $CWD)	
[ -z "$BUILD" ] && BUILD=$DEF_BUILD
[ -f "$DESKTOP" ] || DESKTOP=not
[ -z "$DEPS" ] && DEPS=not	

ARCH=$(uname -m)
case $ARCH in
 *64) 	LIBDIR=$LIBCONF64 ;;
 arm*)	LIBDIR=$LIBCONFarm;;
 *) 	LIBDIR=$LIBCONF32 ;;
esac

build() {
	cd ${PKG}-${VER}
	./configure --prefix=/usr
	[ "$?" -eq 0 ] || exit
	# patch Makefile config.defaults.mk
	sed -i -e 's%prefix\=\/usr\/local%prefix=\${DESTDIR}\/usr%' -e 's%PPPDIR=\/etc\/ppp\/peers%PPPDIR=\${DESTDIR}\/etc\/ppp%' Makefile
	sed -i -e 's%prefix\=\/usr\/local%prefix=\${DESTDIR}\/usr%' config.defaults.mk
	make
	[ "$?" -eq 0 ] || exit
	make DESTDIR=$CWD/${PKG}-install install
	install -d -m 0755 $CWD/${PKG}-install/etc/ppp/peers
	install -m 0644 $CWD/READMEwvdial.txt $CWD/${PKG}-install/etc/ppp/READMEwvdial.txt
	cd -
}
	
# main
retrieve ${PKG}-${VER}.${COMP}
extract ${PKG}-${VER}.${COMP}
build
package_std $PKG $VER $ARCH $DESKTOP "$DESC" $DEPS $CAT	
